From 69ab403d7855df915f6ffc8fafdee13e67a9ca3b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 13 May 2020 20:33:25 -0400 Subject: [PATCH] flowbox: Avoid an assertion in snapshot() The api contract for size_allocate() vfuncs is that they must allocate all the children that are going to be snapshotted in snapshot(). The flowbox size_allocate() was just bailing out when the children request a size of 0x0, leading to an assertion in snapshot() vfunc later. Just allocate all children a size of 0x0 in this case. --- gtk/gtkflowbox.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c index 5c022d45cd..ddbf34fa33 100644 --- a/gtk/gtkflowbox.c +++ b/gtk/gtkflowbox.c @@ -1561,7 +1561,28 @@ gtk_flow_box_size_allocate (GtkWidget *widget, */ get_max_item_size (box, priv->orientation, &min_item_size, &nat_item_size); if (nat_item_size <= 0) - return; + { + child_allocation.x = 0; + child_allocation.y = 0; + child_allocation.width = 0; + child_allocation.height = 0; + + for (iter = g_sequence_get_begin_iter (priv->children); + !g_sequence_iter_is_end (iter); + iter = g_sequence_iter_next (iter)) + { + GtkWidget *child; + + child = g_sequence_get (iter); + + if (!child_is_visible (child)) + continue; + + gtk_widget_size_allocate (child, &child_allocation, -1); + } + + return; + } /* By default flow at the natural item width */ line_length = avail_size / (nat_item_size + item_spacing); -- 2.30.2